package br.com.sgi.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

@Entity
@Table(name = "ACESSO")
@NamedQueries({

//	@NamedQuery(name = "buscarAuthoritiesPorUsername", 
//			query = "SELECT a FROM Authorities a " +
//					" WHERE a.sistema.coSeqSistema =:coSistema " +
//					" AND a.username.username = :username"
//			)	
			
})
public class  Acesso implements Serializable  {

	
	private static final long serialVersionUID = 1L;

	

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "seq_acesso_seqacesso")  
	@SequenceGenerator(name = "seq_acesso_seqacesso", sequenceName = "SGI.seq_acesso") 
	@Column(name="co_seq_acesso")
	private Long coSeqAcesso;
	

	@Column(name="EXIBIR_NO_MENU", length=1)
	@Type(type = "br.com.sgi.type.SimNaoType")
	private Boolean exibirNoMenu;
	
	@Column(name="exibir_editar", length=1)
	@Type(type = "br.com.sgi.type.SimNaoType")
	private Boolean exibirEditar;
	
	@Column(name="exibir_excluir", length=1)
	@Type(type = "br.com.sgi.type.SimNaoType")
	private Boolean exibirExcluir;

	@Column(name="exibir_salvar", length=1)
	@Type(type = "br.com.sgi.type.SimNaoType")
	private Boolean exibirSalvar;
	
	@Column(name="exibir_novo", length=1)
	@Type(type = "br.com.sgi.type.SimNaoType")
	private Boolean exibirNovo;
	
	@ManyToOne
	@JoinColumn(name="CO_FUNCIONALIDADE")
	private Funcionalidade funcionalidade;
	
	@ManyToOne
	@JoinColumn(name="CO_AUTHORITY")
	private Authority authority;

	public Acesso(){
		
	}
	
	public Acesso(boolean exibirNoMenu, boolean exibirEditar, boolean exibirExcluir, 
			boolean exibirSalvar, boolean exibirNovo	){
		
		this.exibirEditar = exibirEditar;
		this.exibirExcluir = exibirExcluir;
		this.exibirNoMenu = exibirNoMenu;
		this.exibirSalvar = exibirSalvar;
		this.exibirNovo = exibirNovo;
		
	}
	
	public Long getCoSeqAcesso() {
		return coSeqAcesso;
	}

	public void setCoSeqAcesso(Long coSeqAcesso) {
		this.coSeqAcesso = coSeqAcesso;
	}

	public Boolean getExibirNoMenu() {
		return exibirNoMenu;
	}

	public void setExibirNoMenu(Boolean exibirNoMenu) {
		this.exibirNoMenu = exibirNoMenu;
	}

	public Boolean getExibirEditar() {
		return exibirEditar;
	}

	public void setExibirEditar(Boolean exibirEditar) {
		this.exibirEditar = exibirEditar;
	}

	public Boolean getExibirExcluir() {
		return exibirExcluir;
	}


	public void setExibirExcluir(Boolean exibirExcluir) {
		this.exibirExcluir = exibirExcluir;
	}

	public Boolean getExibirSalvar() {
		return exibirSalvar;
	}

	public void setExibirSalvar(Boolean exibirSalvar) {
		this.exibirSalvar = exibirSalvar;
	}

	public Boolean getExibirNovo() {
		return exibirNovo;
	}




	public void setExibirNovo(Boolean exibirNovo) {
		this.exibirNovo = exibirNovo;
	}


	




	public Funcionalidade getFuncionalidade() {
		return funcionalidade;
	}




	public void setFuncionalidade(Funcionalidade funcionalidade) {
		this.funcionalidade = funcionalidade;
	}




	public Authority getAuthority() {
		return authority;
	}




	public void setAuthority(Authority authority) {
		this.authority = authority;
	}




	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((coSeqAcesso == null) ? 0 : coSeqAcesso.hashCode());
		return result;
	}

	
}
